package com.wheesper.www.WheesperServer.Net.Session;
import java.util.concurrent.atomic.AtomicInteger;
import io.netty.channel.*;


public class SessionFactory {
	private AtomicInteger sessionIdCounter;
	private static SessionFactory _factory = new SessionFactory();
	private SessionFactory() {
		sessionIdCounter = new AtomicInteger(0);
	}
	
	public static SessionFactory Instance() {
		return _factory;
	}
	
	// Create a uniqure IOSession for the Client 
	public Session createIOSession(Channel channel) {
		Integer sessionId = sessionIdCounter.incrementAndGet();
		return new IOSession(sessionId,channel);
	}
}
